import 'package:flutter/material.dart';

class DebounceUtils {
  DebounceUtils._();

  static bool _disable = false;

  static void debounce({
    VoidCallback? func,
    int seconds = 1,
  }) async {
    if (_disable) return;
    _disable = true;
    func?.call();
    Future.delayed(Duration(seconds: seconds), () {
      _disable = false;
    });
  }
}
